@using NITASA.ViewModels
@{
    List<CL_Menu> Menus = NITASA.Helpers.Functions.GetMenu();
}

<div class="headermenu eight columns noleftmarg">
    <nav id="nav-wrap">
        <ul id="main-menu" class="nav-bar sf-menu">
            <li class="current">
                <a href="/">Home</a>
            </li>
            @{List<CL_Menu> ParentMenus = Menus.Where(m => m.ParentMenuID == 0).ToList();}
            @foreach (CL_Menu parentMenu in ParentMenus)// parent menus
            {
                 <li>
                    <a href="@(string.IsNullOrEmpty(parentMenu.URL)?"#":parentMenu.URL)">@parentMenu.Title</a>
                    @{List<CL_Menu> SubMenus = Menus.Where(m => m.ParentMenuID == parentMenu.MenuID && m.ParentMenuID != 0).ToList();}
                    @if (SubMenus.Count() > 0)
                    {
                        @:<ul>
                    }
                    @foreach (CL_Menu submenu in SubMenus)// sub menus
                    {
                        <li><a href="@(string.IsNullOrEmpty(submenu.URL)?"#":submenu.URL)">@submenu.Title</a></li>
                    }
                    @if (SubMenus.Count() > 0)
                    {
                        @:</ul>
                    }
                </li>
            }
        </ul>
    </nav>
</div>



@*<div class="headermenu eight columns noleftmarg">
        <nav id="nav-wrap">
            <ul id="main-menu" class="nav-bar sf-menu">
                <li class="current">
                    <a href="index.html">Home</a>
                    <ul>
                        <li><a href="index2.html">Without slider</a></li>
                    </ul>
                </li>
                <li>
                    <a href="#">Portofolio</a>
                    <ul>
                        <li><a href="portofolio2.html">2 Columns</a></li>
                        <li><a href="portofolio3.html">3 Columns</a></li>
                        <li><a href="portofolio4.html">4 Columns</a></li>
                        <li><a href="portofoliodetail.html">Project Details</a></li>
                    </ul>
                </li>
                <li>
                    <a href="#">Blog</a>
                    <ul>
                        <li><a href="blogpage1.html">Blog page style 1</a></li>
                        <li><a href="blogpage2.html">Blog page style 2</a></li>
                        <li><a href="blogpage3.html">Blog page style 3</a></li>
                        <li><a href="blogsinglepost.html">Single post</a></li>
                    </ul>
                </li>
                <li>
                    <a href="#">Pages</a>
                    <ul>
                        <li><a href="about.html">About us</a></li>
                        <li><a href="services.html">Services</a></li>
                    </ul>
                </li>
                <li>
                    <a href="#">Features</a>
                    <ul>
                        <li><a href="columns.html">Columns</a></li>
                        <li><a href="elements.html">Elements</a></li>
                        <li><a href="typography.html">Typography</a></li>
                    </ul>
                </li>
                <li>
                    <a href="contact.html">Contact</a>
                </li>
            </ul>
        </nav>
    </div>*@
